package com.csi.bumblebee.controller;

import com.csi.bumblebee.domain.dictionary.EducationBackground;
import com.csi.bumblebee.domain.dictionary.Scale;
import com.csi.bumblebee.domain.util.MyResult;
import com.csi.bumblebee.domain.util.StateCode;
import com.csi.bumblebee.service.ScaleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 孙伟俊
 */
@RestController()
@RequestMapping("/scale")
public class ScaleController {

    @Autowired
    private ScaleService scaleService;

    /**
     * 查询拥有规模
     * @return MyResult<List<Scale>>
     */
    @GetMapping("/")
    public MyResult<List<Scale>> list(){
        MyResult<List<Scale>> myResult = new MyResult<>();

        List<Scale> scaleList = scaleService.list();
        if (scaleList != null){
            myResult.setData(scaleList);
            myResult.setMessage("查询成功");
            myResult.setCode(StateCode.FIND_SUCCESS);
        }else {
            myResult.setCode(StateCode.FIND_FAILURE);
            myResult.setMessage("查询失败");
        }

        return myResult;
    }
}
